In [1]:
import pandas as pd
import numpy as np 
In [2]:
Hygiene2018 = pd.read_csv(r"C:\Users\aniksrukkie\Documents\stats.csv")
Hygiene2018.head()
Out[2]:
No states Household members percentage of hygiene service users
0 32 Abia 3814312 10.2
1 3 ADAMAWA 4343611 10.1
2 7 AKWA IBOM 5363762 10.3
3 11 ANAMBRA 5651329 14.6
4 8 BAUCHI 6721471 1.7
In [3]:
import plotly
In [4]:
import plotly.io as pio
import plotly.express as px
import plotly.graph_objs as go
In [5]:
fig=px.bar(Hygiene2018,y="percentage of hygiene service users", x="states")
fig.show()
In [23]:
import json
In [24]:
with open (r"C:\Users\aniksrukkie\Documents\mfm.geojson") as f:
    HYGIENE = json.load(f)
In [25]:
state_id_map={}
for feature in HYGIENE['features']:
    feature['id']= feature['properties']['OBJECTID']
    state_id_map[feature['properties']['OBJECTID']]=feature['id']
In [26]:
nigeria_coordinates = {"lat":9.0820,"lon":8.6753}
In [29]:
fig = px.choropleth_mapbox(
    Hygiene2018,
    geojson = HYGIENE,
    locations = "No",
    color = "percentage of hygiene service users",
    center = nigeria_coordinates,
    zoom = 5,
    opacity = 0.5,
    hover_name = "states",
    color_continuous_scale= "earth",
    mapbox_style = "carto-positron",
    labels = {"No":"percentage of hygiene service users"}
    
)
fig.show()
In [21]:
pip install geojson
Collecting geojsonNote: you may need to restart the kernel to use updated packages.
  Downloading geojson-2.5.0-py2.py3-none-any.whl (14 kB)
Installing collected packages: geojson
Successfully installed geojson-2.5.0

In [ ]: